package com.duan.design.strategy.head;

import com.duan.design.strategy.head.behavior.fly.FlyRocketPowered;
import com.duan.design.strategy.head.duck.Duck;
import com.duan.design.strategy.head.duck.MallardDuck;
import com.duan.design.strategy.head.duck.RubberDuck;

/**
 * 鸭子测试类
 *
 * @author duanjw
 */
public class MiniDuckSimulator {
    public static void main(String[] args) {
        System.out.println("------绿头鸭出场------");
        Duck mallardDuck = new MallardDuck();

        mallardDuck.display();
        mallardDuck.performFly();
        mallardDuck.performQuack();
        mallardDuck.swim();

        System.out.println("------橡皮鸭出场------");
        Duck rubberDuck = new RubberDuck();
        rubberDuck.display();
        rubberDuck.performFly();
        rubberDuck.setFlyBehavior(new FlyRocketPowered());
        rubberDuck.performFly();
        rubberDuck.performQuack();
        rubberDuck.swim();
    }
}
